package www.yingdi365.com.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import www.yingdi365.com.R;
import www.yingdi365.com.base.ZjbBaseFragment;

/**
 * A simple {@link Fragment} subclass.
 */
public class QingJianYLFragment extends ZjbBaseFragment {


    private View mInflate;
    private String url;
    private ImageView image;

    public QingJianYLFragment() {
        // Required empty public constructor
    }

    public QingJianYLFragment(String url) {
        // Required empty public constructor
        this.url = url;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_qing_jian_yl, container, false);
            init();
        }
        //缓存的rootView需要判断是否已经被加过parent， 如果有parent需要从parent删除，要不然会发生这个rootview已经有parent的错误。
        ViewGroup parent = (ViewGroup) mInflate.getParent();
        if (parent != null) {
            parent.removeView(mInflate);
        }
        return mInflate;
    }

    @Override
    protected void initIntent() {

    }

    @Override
    protected void initSP() {

    }

    @Override
    protected void findID() {
        image = (ImageView) mInflate.findViewById(R.id.image);
    }

    @Override
    protected void initViews() {
        Glide.with(QingJianYLFragment.this)
                .load(url)
                .placeholder(R.mipmap.ic_empty)
                .into(image);
    }

    @Override
    protected void setListeners() {

    }

    @Override
    protected void initData() {

    }
}
